<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../../images/favicon.ico">

    <title>电商</title>
  
	<!-- Bootstrap 4.0-->
	<link rel="stylesheet" href="../../../assets/vendor_components/bootstrap/dist/css/bootstrap.min.css">
	
	<!-- Bootstrap extend-->
	<link rel="stylesheet" href="../../css/bootstrap-extend.css">

	<!-- Theme style -->
	<link rel="stylesheet" href="../../css/master_style.css">

	<!-- Fab Admin skins -->
	<link rel="stylesheet" href="../../css/skins/_all-skins.css">	
	
	<script src="../../js/jquery.min.js"></script>

	<script src="../../js/formatTime.js"></script>
	<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
	<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
	<!--[if lt IE 9]>
	<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
	<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
	<![endif]-->

</head>
<body class="hold-transition skin-blue-light sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">

	<!-- 顶部导航栏 -->
	<span id="mytop"></span>
	<span id="myleft"></span>
	<script>
		$(function(){
			/*公共部分
             * 导航栏
             */
			$("#mytop").load("header.html");
			$("#myleft").load("left.html");
		});
	</script>

  <!-- =============================================== -->

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        	商品管理
      </h1>
    </section>
	
    	
		 <div class="box box-default">
			<div class="box-body">
				<ul class="nav nav-tabs nav-fill" role="tablist">
					<!-- 内部panel导航栏 -->
					<li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#list" role="tab"><span class="hidden-sm-up"><i class="ion-person"></i></span> <span class="hidden-xs-down">商品列表</span></a> </li>
					<li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#add" role="tab"><span class="hidden-sm-up"><i class="ion-home"></i></span> <span class="hidden-xs-down">添加商品</span></a> </li>
					<!-- <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#messages11" role="tab"><span class="hidden-sm-up"><i class="ion-email"></i></span> <span class="hidden-xs-down">Messages</span></a> </li> -->
				</ul>
					<!-- Tab panes -->
					<div class="tab-content tabcontent-border">
						<!-- 第一个panel -->
						<div class="tab-pane active" id="list" role="tabpanel">
							<div class="tab-pane pad" id="profile11" role="tabpanel">
								每页展示&nbsp;&nbsp; <label>
									<select id="productorder_length" name="productorder_length" aria-controls="productorder" class="form-control form-control-sm">
										<option value="2">2</option>
										<option value="10">10</option>
										<option value="25">25</option>
										<option value="50">50</option>
									</select>
								</label>&nbsp;&nbsp;条
								
									
							<!-- 查看所有类别，进行分页处理 -->
								<div class="table-responsive">
									<table id="productorder" class="table table-hover no-wrap product-order" data-page-size="12">
										<thead>
											<tr>
												 <th>id</th>
												 <th>name</th>
												 <th>descr</th>
												 <th>normalprice</th>
												 <th>memberprice</th>
												 <th>pdate</th>
												 <th>categoryid</th>
												 <th>operator</th>
												 <img src="D:\JAVA\Tomcat\tomcat8\wtpwebapps\shop\upload\logo.png"/>
											</tr>
										</thead>
										<tbody>
											<!-- 使用ajax向列表中添加数据 -->
											<script>
												$(document).ready(function(){
													
													/* 计算总页数 */
													/* 传过去每页展示条数，返回总页数 */
													function countPageNo(){
														$.ajax({
					                                            url: "../../../countPageNo.product",
					                                            dataType: "json",
					                                            type: "get",
					                                            data: {
					                                            	num: $("#productorder_length").val()
					                                            },
					                                            success: function (jsonPageNo) {
					                                                $("#sumPage").text(jsonPageNo);
					                                            }
					                                        }); 
													}
													countPageNo(num);
													/* 每页展示多少条数据 */
													var num = $("#productorder_length").val();
													/* 当前页码 */
													var curPage = $("#curPage").text();
				                                    $.ajax({
				                                            url: "../../../findByPageno.product",
				                                            dataType: "json",
				                                            type: "get",
				                                            data: {
				                                            	num: num,
				                                            	curPage: curPage
				                                            },
				                                            success: function (jsonAll) {
				                                                for (let i = 0; i < jsonAll.length; i++) {
				                                                	$(
				                                                		"<tr>"+
																		"<td>"+jsonAll[i].id+"</td>"+
																		"<td>"+jsonAll[i].name+"</td>"+
																		"<td>"+jsonAll[i].descr+"</td>"+
																		"<td>"+jsonAll[i].normalprice+"</td>"+
																		"<td>"+jsonAll[i].memberprice+"</td>"+
																		"<td>"+getTime(getTime(jsonAll[i].pdate))+"</td>"+
																		"<td>"+jsonAll[i].categoryid+"</td>"+
																		"<td><button type='button' data-id='"+jsonAll[i].id+"' data-name='"+jsonAll[i].name+"' data-descr='"+jsonAll[i].descr+"' data-normalprice='"+jsonAll[i].normalprice+"' data-memberprice='"+jsonAll[i].memberprice+"' data-pdate='"+getTime(jsonAll[i].pdate)+"'data-categoryid='"+jsonAll[i].categoryid+"' class='btn btn-rounded btn-info btn-xs'  data-toggle='modal' data-target='#productModal'>"+
																		"编辑</button>"+
																		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type='button' class='btn btn-rounded btn-danger btn-xs'onclick='del("+jsonAll[i].id+")'>删除</button></td></tr>"
																	).appendTo("tbody");
				                                                }
				                                            }
				                                        });
				                                    /* 根据每页展示数据量的选择，展示数据 */
				                                    $("#productorder_length").change(function(){
				                                    	/* 根据当前页面展示条数，重新计算总页数 */
				                                    	countPageNo();
				                                    	$("tbody").html("");
				                                    	/* 每页展示多少条数据 */
														var num = $("#productorder_length").val();
														/* 当前页码 */
														var curPage = $("#curPage").text();
					                                    $.ajax({
					                                            url: "../../../findByPageno.product",
					                                            dataType: "json",
					                                            type: "get",
					                                            data: {
					                                            	num: num,
					                                            	curPage: curPage
					                                            },
					                                            success: function (jsonAll) {
					                                                for (let i = 0; i < jsonAll.length; i++) {
					                                                	$(
					                                                		"<tr>"+
																			"<td>"+jsonAll[i].id+"</td>"+
																			"<td>"+jsonAll[i].name+"</td>"+
																			"<td>"+jsonAll[i].descr+"</td>"+
																			"<td>"+jsonAll[i].normalprice+"</td>"+
																			"<td>"+jsonAll[i].memberprice+"</td>"+
																			"<td>"+getTime(jsonAll[i].pdate)+"</td>"+
																			"<td>"+jsonAll[i].categoryid+"</td>"+
																			"<td><button type='button' data-id='"+jsonAll[i].id+"' data-name='"+jsonAll[i].name+"' data-descr='"+jsonAll[i].descr+"' data-normalprice='"+jsonAll[i].normalprice+"' data-memberprice='"+jsonAll[i].memberprice+"' data-pdate='"+getTime(jsonAll[i].pdate)+"'data-categoryid='"+jsonAll[i].categoryid+"' class='btn btn-rounded btn-info btn-xs'  data-toggle='modal' data-target='#productModal'>"+
																			"编辑</button>"+
																			"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type='button' class='btn btn-rounded btn-danger btn-xs'onclick='del("+jsonAll[i].id+")'>删除</button></td></tr>"
																		).appendTo("tbody");
					                                                }
					                                            }
					                                        });
				                                    });
				                                    
				                                });
												/* 首页 传第一页的给上一页的逻辑 */
												function firstPage(){
													/* 每页展示多少条数据 */
													var num = $("#productorder_length").val();
													$("tbody").html("");
													$("#curPage").text("1");
				                                    $.ajax({
				                                            url: "../../../pageUp.product",
				                                            dataType: "json",
				                                            type: "get",
				                                            data: {
				                                            	num: num,
				                                            	curPage: 1
				                                            },
				                                            success: function (jsonAll) {
				                                            	//修改当前页显示
				                                                for (let i = 0; i < jsonAll.length; i++) {
				                                                	$(
				                                                		"<tr>"+
																		"<td>"+jsonAll[i].id+"</td>"+
																		"<td>"+jsonAll[i].name+"</td>"+
																		"<td>"+jsonAll[i].descr+"</td>"+
																		"<td>"+jsonAll[i].normalprice+"</td>"+
																		"<td>"+jsonAll[i].memberprice+"</td>"+
																		"<td>"+getTime(jsonAll[i].pdate)+"</td>"+
																		"<td>"+jsonAll[i].categoryid+"</td>"+
																		"<td><button type='button' data-id='"+jsonAll[i].id+"' data-name='"+jsonAll[i].name+"' data-descr='"+jsonAll[i].descr+"' data-normalprice='"+jsonAll[i].normalprice+"' data-memberprice='"+jsonAll[i].memberprice+"' data-pdate='"+getTime(jsonAll[i].pdate)+"'data-categoryid='"+jsonAll[i].categoryid+"' class='btn btn-rounded btn-info btn-xs'  data-toggle='modal' data-target='#productModal'>"+
																		"编辑</button>"+
																		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type='button' class='btn btn-rounded btn-danger btn-xs'onclick='del("+jsonAll[i].id+")'>删除</button></td></tr>"
																	).appendTo("tbody");
				                                                }
				                                            }
				                                        });
													}
												/* 尾页 传最后一页给下一页逻辑 */
												function lastPage(){
													
													/* 每页展示多少条数据 */
													var num = $("#productorder_length").val();
													//当前总页数
													var sumPage = $("#sumPage").text();
													$("tbody").html("");
													$("#curPage").text(sumPage);
				                                    $.ajax({
				                                            url: "../../../pageDown.product",
				                                            dataType: "json",
				                                            type: "get",
				                                            data: {
				                                            	num: num,
				                                            	curPage: sumPage,
				                                            	sumPage: sumPage
				                                            },
				                                            success: function (jsonAll) {
				                                            	//修改当前页显示
				                                                for (let i = 0; i < jsonAll.length; i++) {
				                                                	$(
				                                                		"<tr>"+
																		"<td>"+jsonAll[i].id+"</td>"+
																		"<td>"+jsonAll[i].name+"</td>"+
																		"<td>"+jsonAll[i].descr+"</td>"+
																		"<td>"+jsonAll[i].normalprice+"</td>"+
																		"<td>"+jsonAll[i].memberprice+"</td>"+
																		"<td>"+getTime(jsonAll[i].pdate)+"</td>"+
																		"<td>"+jsonAll[i].categoryid+"</td>"+
																		"<td><button type='button' data-id='"+jsonAll[i].id+"' data-name='"+jsonAll[i].name+"' data-descr='"+jsonAll[i].descr+"' data-normalprice='"+jsonAll[i].normalprice+"' data-memberprice='"+jsonAll[i].memberprice+"' data-pdate='"+getTime(jsonAll[i].pdate)+"'data-categoryid='"+jsonAll[i].categoryid+"' class='btn btn-rounded btn-info btn-xs'  data-toggle='modal' data-target='#productModal'>"+
																		"编辑</button>"+
																		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type='button' class='btn btn-rounded btn-danger btn-xs'onclick='del("+jsonAll[i].id+")'>删除</button></td></tr>"
																	).appendTo("tbody");
				                                                }
				                                            }
				                                        });
													}
												
												/* 下一页 */
												function pageDown(){
													
													/* 每页展示多少条数据 */
													var num = $("#productorder_length").val();
													/* 当前页码 */
													var curPage = $("#curPage").text();
													var nextPage = parseInt(curPage);
													//当前总页数
													var sumPage = $("#sumPage").text();
													//如果当前页不是最后一页，当前页再加一，否则不变
													if(curPage != sumPage){
														nextPage = parseInt(curPage) + 1;
													}
													$("tbody").html("");
													$("#curPage").text(nextPage);
				                                    $.ajax({
				                                            url: "../../../pageDown.product",
				                                            dataType: "json",
				                                            type: "get",
				                                            data: {
				                                            	num: num,
				                                            	curPage: curPage,
				                                            	sumPage: sumPage
				                                            },
				                                            success: function (jsonAll) {
				                                            	//修改当前页显示
				                                                for (let i = 0; i < jsonAll.length; i++) {
				                                                	$(
				                                                		"<tr>"+
																		"<td>"+jsonAll[i].id+"</td>"+
																		"<td>"+jsonAll[i].name+"</td>"+
																		"<td>"+jsonAll[i].descr+"</td>"+
																		"<td>"+jsonAll[i].normalprice+"</td>"+
																		"<td>"+jsonAll[i].memberprice+"</td>"+
																		"<td>"+getTime(jsonAll[i].pdate)+"</td>"+
																		"<td>"+jsonAll[i].categoryid+"</td>"+
																		"<td><button type='button' data-id='"+jsonAll[i].id+"' data-name='"+jsonAll[i].name+"' data-descr='"+jsonAll[i].descr+"' data-normalprice='"+jsonAll[i].normalprice+"' data-memberprice='"+jsonAll[i].memberprice+"' data-pdate='"+getTime(jsonAll[i].pdate)+"'data-categoryid='"+jsonAll[i].categoryid+"' class='btn btn-rounded btn-info btn-xs'  data-toggle='modal' data-target='#productModal'>"+
																		"编辑</button>"+
																		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type='button' class='btn btn-rounded btn-danger btn-xs'onclick='del("+jsonAll[i].id+")'>删除</button></td></tr>"
																	).appendTo("tbody");
				                                                }
				                                            }
				                                        });
													}
												/* 上一页 */
												function pageUp(){
													/* 每页展示多少条数据 */
													var num = $("#productorder_length").val();
													/* 当前页码 */
													var curPage = $("#curPage").text();
													var prePage = parseInt(curPage);
													//如果当前页不是第一页再减一，否则不变
													if(curPage != 1){
														prePage = parseInt(curPage) - 1;
													}
													
													$("tbody").html("");
													$("#curPage").text(prePage);
				                                    $.ajax({
				                                            url: "../../../pageUp.product",
				                                            dataType: "json",
				                                            type: "get",
				                                            data: {
				                                            	num: num,
				                                            	curPage: curPage
				                                            },
				                                            success: function (jsonAll) {
				                                            	//修改当前页显示
				                                                for (let i = 0; i < jsonAll.length; i++) {
				                                                	$(
				                                                		"<tr>"+
																		"<td>"+jsonAll[i].id+"</td>"+
																		"<td>"+jsonAll[i].name+"</td>"+
																		"<td>"+jsonAll[i].descr+"</td>"+
																		"<td>"+jsonAll[i].normalprice+"</td>"+
																		"<td>"+jsonAll[i].memberprice+"</td>"+
																		"<td>"+getTime(jsonAll[i].pdate)+"</td>"+
																		"<td>"+jsonAll[i].categoryid+"</td>"+
																		"<td><button type='button' data-id='"+jsonAll[i].id+"' data-name='"+jsonAll[i].name+"' data-descr='"+jsonAll[i].descr+"' data-pid='"+jsonAll[i].normalprice+"' data-leaf='"+jsonAll[i].memberprice+"' data-grade='"+getTime(jsonAll[i].pdate)+"'"+ 
																		"class='btn btn-rounded btn-info btn-xs'  data-toggle='modal' data-target='#productModal'  data-toggle='modal' data-target='#productModal'>"+
																		"编辑</button>"+
																		"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type='button' class='btn btn-rounded btn-danger btn-xs' onclick='del("+jsonAll[i].id+")'>删除</button></td></tr>"
																	).appendTo("tbody");
				                                                }
				                                            }
				                                        });
													
													}
												
												function del(id) {
													if (confirm("你确定删除吗")) {
														window.location.href = "deleteProduct.product?id="+id
													}
												}
												
											</script>
										</tbody>						
									</table>
									
										
									<!-- 翻页 -->
									<div class="row">
										<div class="col-sm-12 col-md-7"></div>
										<div class="col-sm-12 col-md-5">
											<div class="dataTables_paginate paging_simple_numbers" id="productorder_paginate">
											<ul class="pagination">
												<li class="paginate_button page-item previous" id="productorder_previous">
													<a href="javascript:firstPage()" aria-controls="productorder" data-dt-idx="0" tabindex="0" class="page-link">首页</a>
												</li>
												<li class="paginate_button page-item previous" id="productorder_previous">
													<a href="javascript:pageUp()" aria-controls="productorder" data-dt-idx="0" tabindex="0" class="page-link">上一页</a>
												</li>
												<li class="paginate_button page-item active">
													第<a id="curPage" href="#" aria-controls="productorder" data-dt-idx="1" tabindex="0" class="page-link">1</a>页
												</li>
												
												<li class="paginate_button page-item next" id="productorder_next">
													<a href="javascript:pageDown()" aria-controls="productorder" data-dt-idx="3" tabindex="0" class="page-link">下一页</a>
												</li>
												<li class="paginate_button page-item previous" id="productorder_previous">
													<a href="javascript:lastPage()" aria-controls="productorder" data-dt-idx="0" tabindex="0" class="page-link">尾页</a>
												</li>
												
												<li>
													&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共&nbsp;&nbsp;<label id="sumPage">21</label>&nbsp;&nbsp;页
												</li>
												<li>
													
												</li>
											</ul>
										</div>
									</div>
									
									</div>
									
								</div>
							</div>
						</div>
	      				<!-- 第二个panel开始 -->
	      				<div class="tab-pane" id="add" role="tabpanel">
							<div class="row">
							  <div class="col-12">
							    <div class="box">
									<div class="box-header with-border">
									  <h3 class="box-title">商品信息</h3>
									</div>
					              <div class="box-body">
									<form action="insertProduct.product" name="insert" method="post" enctype="multipart/form-data">
										<div class="form-body">
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
													  <label class="text-info">商品名称</label>
													  <input required type="text" name="name" class="form-control" placeholder="">
													</div>
												</div>
												<!--/span-->
												
												<!--/span-->
											</div>
											<!--/row-->
											<!--/row-->
											<div class="row">
												<div class="col-md-12">
													<div class="form-group">
														<label class="text-info">商品描述</label>
														<textarea required name="descr" class="form-control" rows="4"></textarea>
													</div>
												</div>
											</div>
											<!--/row-->
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
														<label class="text-info">普通价格</label>
														<div class="input-group">
															<div class="input-group-addon"><i class="ti-money"></i></div>
															<input required name="normalprice" type="number" class="form-control"> </div>
													</div>
												</div>
												<!--/span-->
												<div class="col-md-6">
													<div class="form-group">
														<label class="text-info">会员价格</label>
														<div class="input-group">
															<div class="input-group-addon"><i class="ti-cut"></i></div>
															<input required name="memberprice" type="number" class="form-control" ></div>
													</div>
												</div>
												<!--/span-->
											</div>
											
											<!--/row-->
											<div class="row">
												<div class="col-md-8">
													<label class="text-info">类别选择</label>
													<div class="form-group">
													  <div class="row">
													    <div class="col-md-4">
													      <select name="category1" id="category1" class="form-control combox" required>
													      	<option value="">----请选择----</option>
													      </select>
													    </div>
													    <div class="col-md-4">
													      <select name="category2" id="category2" class="form-control" required>
													      	<option value="">----请选择----</option>
													      </select>
													    </div>
													    <div class="col-md-4">
													      <select name="category3" id="category3" class="form-control" required>
													      	<option value="">----请选择----</option>
													      </select>
													    </div>
													  </div>
													</div>
													<a type="text" name="" href="category.html" class=" btn-rounded bg-pale-dark ">&nbsp;&nbsp;没有合适的类别？点击去创建&nbsp;&nbsp;</a>
													<div class="row" style="height: 70px"></div>
												</div>
												<script>
													$(document).ready(function(){
														
														$.ajax({
															url: "category1.product",
															dataType: "json",
															success: function(json){
																for(let i=0; i< json.length; i++){
																	let p = json[i];
																	$("<option value='"+p.id+"''>"+p.name+"</option>").appendTo("#category1")
																}
															}
														});
														
														$("#category1").change(function(){
															$("#category2").html("<option value=''>----请选择----</option>");
														});
														
														
														$("#category1").change(function(){
															$.ajax({
																url: "category2.product?pid="+$("#category1").val(),
																dataType: "json",
																success: function(json){
																	$("#cities").html("<option value=''>----请选择----</option>");
																	for(let i=0; i< json.length; i++){
																		let c = json[i];
																		$("<option value='"+c.id+"''>"+c.name+"</option>").appendTo("#category2")
																	}
																}
															});
														});
														
														//区的AJAX
														$("#category2").change(function(){
															$.ajax({
																url: "category3.product?pid="+$("#category2").val(),
																dataType: "json",
																success: function(json){
																	$("#category3").html("<option value=''>----请选择----</option>");
																	for(let i=0; i< json.length; i++){
																		let a = json[i];
																		$("<option value='"+a.id+"''>"+a.name+"</option>").appendTo("#category3")
																	}
																}
															});
														});
													});
													
												
												</script>
												
											</div>
												<!--/span-->
											<div class="row">
												<div class="col-md-6">
														<div class="form-group">
															<label class="text-info">发布状态</label>
															<div class="radio-list">
																<label class="radio-inline p-0 mr-10">
																	<div class="radio radio-info">
																		<input type="radio" name="radio" id="radio1" value="1">
																		<label for="radio1">发布</label>
																	</div>
																</label>
																<label class="radio-inline">
																	<div class="radio radio-info">
																		<input type="radio" name="radio" id="radio2" value="0">
																		<label for="radio2">草稿</label>
																	</div>
																</label>
															</div>
														</div>
													</div>	
												<div class="col-md-3">
													<!-- 图片上传 -->										
													<input id="upload" name="upload" type="file" accept="image/png, image/jpeg, image/gif, image/jpg">
													
												</div>
											</div>
											
										</div>
										<div class="form-actions mt-10">
											<button type="submit" class="btn btn-success" > <i class="fa fa-check"></i>保存</button>
											<button type="button" class="btn btn-danger"><i class="fa fa-close"></i>取消</button>
										</div>
									</form>
					              </div>
					            </div>
							  </div>		  
						  </div>
						  <!-- /.row -->
						</div>
						<!-- 第二个panel结束 -->
	   			</div>			
	   		</div>
	   	</div>
  </div>
  <!-- 模态框 -->
  <div class="modal fade" id="productModal" tabindex="-1" role="dialog" aria-labelledby="productModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
	        <div class="modal-content">
	            <div class="modal-header">
	                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
	                <h4 class="modal-title" id="productModalLabel"></h4>
	            </div>
	            <div class="modal-body">
	            	<div class="box box-solid bg-primary">
		                <div class="box-header">
		                    <h4 class="box-title">
		                    		修改商品
		                    </h4>
		                </div>
		
		                <div class="box-body">
		    
		                    <form action="updateProduct.product" name="insert" method="post">
										<div class="form-body">
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
													  <label class="text-info">商品名称</label>
													  <input id="modal_name" required type="text" name="name" class="form-control"/>
													</div>
		                                        	<input id="id" type="hidden" name="modal_id"/>
												</div>
												<!--/span-->
												
												<!--/span-->
											</div>
											<!--/row-->
											<!--/row-->
											<div class="row">
												<div class="col-md-12">
													<div class="form-group">
														<label class="text-info">商品描述</label>
														<textarea id="modal_descr" required name="descr" class="form-control" rows="4"></textarea>
													</div>
												</div>
											</div>
											<!--/row-->
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
														<label class="text-info">普通价格</label>
														<div class="input-group">
															<div class="input-group-addon"><i class="ti-money"></i></div>
															<input required id="modal_normalprice" name="normalprice" type="number" class="form-control"/> </div>
													</div>
												</div>
												<!--/span-->
												<div class="col-md-6">
													<div class="form-group">
														<label class="text-info">会员价格</label>
														<div class="input-group">
															<div class="input-group-addon"><i class="ti-cut"></i></div>
															<input required id="memberprice" name="memberprice" type="number" class="form-control" /></div>
													</div>
												</div>
												<!--/span-->
											</div>
											
											<!--/row-->
											<div class="row">
												<div class="col-md-8">
													<label class="text-info">类别选择</label>
													<div class="form-group">
													  <div class="row">
													    <div class="col-md-4">
													      <select name="category1" id="category1" class="form-control combox" required>
													      	<option value="">----请选择----</option>
													      </select>
													    </div>
													    <div class="col-md-4">
													      <select name="category2" id="category2" class="form-control" required>
													      	<option value="">----请选择----</option>
													      </select>
													    </div>
													    <div class="col-md-4">
													      <select name="category3" id="category3" class="form-control" required>
													      	<option value="">----请选择----</option>
													      </select>
													    </div>
													  </div>
													</div>
													<a type="text" name="" href="category.html" class=" btn-rounded bg-pale-dark ">&nbsp;&nbsp;没有合适的类别？点击去创建&nbsp;&nbsp;</a>
													<div class="row" style="height: 70px"></div>
												</div>
												<script>
													$(document).ready(function(){
														
														$.ajax({
															url: "category1.product",
															dataType: "json",
															success: function(json){
																for(let i=0; i< json.length; i++){
																	let p = json[i];
																	$("<option value='"+p.id+"''>"+p.name+"</option>").appendTo("#category1")
																}
															}
														});
														
														$("#category1").change(function(){
															$("#category2").html("<option value=''>----请选择----</option>");
														});
														
														
														$("#category1").change(function(){
															$.ajax({
																url: "category2.product?pid="+$("#category1").val(),
																dataType: "json",
																success: function(json){
																	$("#cities").html("<option value=''>----请选择----</option>");
																	for(let i=0; i< json.length; i++){
																		let c = json[i];
																		$("<option value='"+c.id+"''>"+c.name+"</option>").appendTo("#category2")
																	}
																}
															});
														});
														
														//区的AJAX
														$("#category2").change(function(){
															$.ajax({
																url: "category3.product?pid="+$("#category2").val(),
																dataType: "json",
																success: function(json){
																	$("#category3").html("<option value=''>----请选择----</option>");
																	for(let i=0; i< json.length; i++){
																		let a = json[i];
																		$("<option value='"+a.id+"''>"+a.name+"</option>").appendTo("#category3")
																	}
																}
															});
														});
													});
													
												
												</script>
												
											</div>
												<!--/span-->
											<div class="row">
												<div class="col-md-6">
														<div class="form-group">
															<label class="text-info">发布状态</label>
															<div class="radio-list">
																<label class="radio-inline p-0 mr-10">
																	<div class="radio radio-info">
																		<input type="radio" name="radio" id="radio1" value="1">
																		<label for="radio1">发布</label>
																	</div>
																</label>
																<label class="radio-inline">
																	<div class="radio radio-info">
																		<input type="radio" name="radio" id="radio2" value="0">
																		<label for="radio2">草稿</label>
																	</div>
																</label>
															</div>
														</div>
													</div>	
												<div class="col-md-3">
													
												</div>
											</div>
											
										</div>
										<div class="form-actions mt-10">
											<button type="submit" class="btn btn-success" > <i class="fa fa-check"></i>保存</button>
											<button type="button" class="btn btn-danger"><i class="fa fa-close"></i>取消</button>
										</div>
									</form>
		                    
		                    
		                </div>
		            </div>
	            </div>
	        </div><!-- /.modal-content -->
	    </div><!-- /.modal -->
	</div>
	<script type="text/javascript">
      /* 将页面中的数据传给模态框 */
      $('#productModal').on('shown.bs.modal', function (event) {
	      var btn = $(event.relatedTarget); //触发事件的按钮
	      var modal = $(this);  //当前模态框
	      var id = btn.data('id')
	      var name = btn.data('name')
	      var descr = btn.data('descr')
	      var normalprice = btn.data('normalprice')
	      var memberprice = btn.data('memberprice')
	      var categoryid = btn.data('categoryid')
	      var pdate = btn.data('pdate')
	      $('#modal_name').val(name)
	      $('#modal_descr').val(descr)
	      $('#modal_normalprice').val(normalprice)
	      $('#modal_memberprice').val(memberprice)
	      $('#modal_categoryid').val(categoryid)
	      $('#modal_pdate').val(pdate)
	      /* 在input隐藏域中传递id */
	      $('#id').val(id)
	});
    </script>
  <!-- /.content-wrapper -->
 
   <footer class="main-footer">
    <div class="pull-right d-none d-sm-inline-block">
        <ul class="nav nav-primary nav-dotted nav-dot-separated justify-content-center justify-content-md-end">
		  <li class="nav-item">
			<a class="nav-link" href="javascript:void(0)">FAQ</a>
		  </li>
		  <li class="nav-item">
			<a class="nav-link" href="#">Purchase Now</a>
		  </li>
		</ul>
    </div>
	  &copy; 2018 <a href="https://www.multipurposethemes.com/">Multi-Purpose Themes</a>. All Rights Reserved.
  </footer>
  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-light">
    <!-- Create the tabs -->
    <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
      <li class="nav-item"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
      <li class="nav-item"><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-cog fa-spin"></i></a></li>
    </ul>
    <!-- Tab panes -->
    <div class="tab-content">
      <!-- Home tab content -->
      <div class="tab-pane" id="control-sidebar-home-tab">
        <h3 class="control-sidebar-heading">Recent Activity</h3>
        <ul class="control-sidebar-menu">
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-birthday-cake bg-danger"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Admin Birthday</h4>

                <p>Will be July 24th</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-user bg-warning"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Jhone Updated His Profile</h4>

                <p>New Email : jhone_doe@demo.com</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-envelope-o bg-info"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Disha Joined Mailing List</h4>

                <p>disha@demo.com</p>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <i class="menu-icon fa fa-file-code-o bg-success"></i>

              <div class="menu-info">
                <h4 class="control-sidebar-subheading">Code Change</h4>

                <p>Execution time 15 Days</p>
              </div>
            </a>
          </li>
        </ul>
        <!-- /.control-sidebar-menu -->

        <h3 class="control-sidebar-heading">Tasks Progress</h3>
        <ul class="control-sidebar-menu">
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Web Design
                <span class="label label-danger pull-right">40%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-danger" style="width: 40%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Update Data
                <span class="label label-success pull-right">75%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-success" style="width: 75%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Order Process
                <span class="label label-warning pull-right">89%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-warning" style="width: 89%"></div>
              </div>
            </a>
          </li>
          <li>
            <a href="javascript:void(0)">
              <h4 class="control-sidebar-subheading">
                Development 
                <span class="label label-primary pull-right">72%</span>
              </h4>

              <div class="progress progress-xxs">
                <div class="progress-bar progress-bar-primary" style="width: 72%"></div>
              </div>
            </a>
          </li>
        </ul>
        <!-- /.control-sidebar-menu -->

      </div>
      <!-- /.tab-pane -->
      <!-- Stats tab content -->
      <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
      <!-- /.tab-pane -->
      <!-- Settings tab content -->
      <div class="tab-pane" id="control-sidebar-settings-tab">
        <form method="post">
          <h3 class="control-sidebar-heading">General Settings</h3>

          <div class="form-group">
            <input type="checkbox" id="report_panel" class="chk-col-grey" >
			<label for="report_panel" class="control-sidebar-subheading ">Report panel usage</label>

            <p>
              general settings information
            </p>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <input type="checkbox" id="allow_mail" class="chk-col-grey" >
			<label for="allow_mail" class="control-sidebar-subheading ">Mail redirect</label>

            <p>
              Other sets of options are available
            </p>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <input type="checkbox" id="expose_author" class="chk-col-grey" >
			<label for="expose_author" class="control-sidebar-subheading ">Expose author name</label>

            <p>
              Allow the user to show his name in blog posts
            </p>
          </div>
          <!-- /.form-group -->

          <h3 class="control-sidebar-heading">Chat Settings</h3>

          <div class="form-group">
            <input type="checkbox" id="show_me_online" class="chk-col-grey" >
			<label for="show_me_online" class="control-sidebar-subheading ">Show me as online</label>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <input type="checkbox" id="off_notifications" class="chk-col-grey" >
			<label for="off_notifications" class="control-sidebar-subheading ">Turn off notifications</label>
          </div>
          <!-- /.form-group -->

          <div class="form-group">
            <label class="control-sidebar-subheading">              
              <a href="javascript:void(0)" class="text-red margin-r-5"><i class="fa fa-trash-o"></i></a>
              Delete chat history
            </label>
          </div>
          <!-- /.form-group -->
        </form>
      </div>
      <!-- /.tab-pane -->
    </div>
  </aside>
  <!-- /.control-sidebar -->
  
  <!-- Add the sidebar's background. This div must be placed immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->


	<!-- jQuery 3 -->
	<script src="../../../assets/vendor_components/jquery/dist/jquery.min.js"></script>
	
	<!-- popper -->
	<script src="../../../assets/vendor_components/popper/dist/popper.min.js"></script>
	
	<!-- Bootstrap 4.0-->
	<script src="../../../assets/vendor_components/bootstrap/dist/js/bootstrap.min.js"></script>
	
	<!-- SlimScroll -->
	<script src="../../../assets/vendor_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
	
	<!-- FastClick -->
	<script src="../../../assets/vendor_components/fastclick/lib/fastclick.js"></script>
	
	<!-- Fab Admin App -->
	<script src="../../js/template.js"></script>
	
	<!-- Fab Admin for demo purposes -->
	<script src="../../js/demo.js"></script>
	

</body>
</html>
